<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <script src="../../lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
    <script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script src="../../lib/jq-module/jquery.particleground.min.js" charset="utf-8"></script>
</head>

<body>
<a href="spotInfo.html" class="layui-btn layui-btn-normal">返回</a>
<div class="layui-container">
    <div class="layui-row">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header" id="name">景点1</div>
                <div class="layui-card-body">
                    <img id="imageUrl"
                         src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Ffc2d272d-3899-4af7-a6b0-bcb640b9cdd2%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1687241519&t=6e2cc312aa52a9d725972b8e3ea5be90"
                         alt="" class="layui-upload-img" style="max-width: 100%;">
                    <p id="introduction">这是景点1的详细介绍</p>
                </div>
                <h3 style="float: right;" id="createTime">发布日期：2022年2月2日</h3>
            </div>
        </div>
    </div>
</div>

</body>
<script>
    $(function () {
        //js获取url中的参数
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return decodeURI(r[2]);
            return null;
        }

        var id = GetQueryString('id');
        $.ajax({
            url: "/api/spot?operation=getOne&id=" + id,
            type: "get",
            success: function (resp) {
                console.log(resp.data);
                $("#name").text(resp.data.name);
                $("#introduction").text(resp.data.introduction);
                $("#createTime").text("发布日期：" + resp.data.createTime);
                $("#imageUrl").attr("src", resp.data.imageUrl);
            }
        })
    })
</script>
</html>